#include <cv.h>
#include <highgui.h>
#include "abstractProbabilityTransformer.hpp"
#include "abstractFilter.hpp"
#include "resourceTracker.h"
#include "faceDetector.h"
#include "AbstractHandTracker.hpp"
#include "HIVideoCapture.hpp"
#include "handLocaliser.hpp"

#include "AbstractHandTrackerTest.hpp"
#include "HandTrackerLKGREYwMSwBPwBGSUBwFOx.hpp"

#include <iostream>
//TODO clean up includes

//this looks up the location of the gtest files in header hiDependenciesForTestFramework.h
//TODO : Design choice? currently I'll keep this dependency in a very specific header file
// as changing it should cause minimal recompilation.

#include "gtest.h"

//NOTE: hiDependenciesForTestFramework also sets HI_TEST_VISUALISATION
//which if set will make tests compile to show images of the things they test.

//FIXNOW: normalise error according to tracking rect size? (include both normalised and raw error)

using namespace cv;

class HandTrackerLKGREYwMSwBPwBGSUBwFOxTest : public ::AbstractHandTrackerTest {
protected:
	void setHandTracker(int trackerCode);
};


// -- test case codes -- //
#define FO0 0
#define FO1 1
#define FO2 2
#define FO3 3
#define FO4 4


void HandTrackerLKGREYwMSwBPwBGSUBwFOxTest::setHandTracker(int trackerCode) {
	
	switch ( trackerCode ) {
		case FO0:
			ht = HandTrackerLKGREYwMSwBPwBGSUBwFOx::init(
												   hl->getProbabilityTransformer(), trackingRect, frame,
												   Ptr< AbstractFilter >(new OpenFilter(0))  );
			break;
		case FO1:
			ht = HandTrackerLKGREYwMSwBPwBGSUBwFOx::init(
												   hl->getProbabilityTransformer(), trackingRect, frame,
												   Ptr< AbstractFilter >(new OpenFilter(1))  );
			break;
		case FO2:
			ht = HandTrackerLKGREYwMSwBPwBGSUBwFOx::init(
												   hl->getProbabilityTransformer(), trackingRect, frame,
												   Ptr< AbstractFilter >(new OpenFilter(2))  );
			break;
		case FO3:
			ht = HandTrackerLKGREYwMSwBPwBGSUBwFOx::init(
												   hl->getProbabilityTransformer(), trackingRect, frame,
												   Ptr< AbstractFilter >(new OpenFilter(3))  );
			break;
		case FO4:
			ht = HandTrackerLKGREYwMSwBPwBGSUBwFOx::init(
												   hl->getProbabilityTransformer(), trackingRect, frame,
												   Ptr< AbstractFilter >(new OpenFilter(4))  );
			break;
		default:
			ASSERT_TRUE(false);
			break;
	}
}

TEST_F(HandTrackerLKGREYwMSwBPwBGSUBwFOxTest, FO0wlocVid1c ) {
	testTracker( FO0, "locVid1c" );
}

TEST_F(HandTrackerLKGREYwMSwBPwBGSUBwFOxTest, FO1wlocVid1c ) {
	testTracker( FO1, "locVid1c" );
}

TEST_F(HandTrackerLKGREYwMSwBPwBGSUBwFOxTest, FO2wlocVid1c ) {
	testTracker( FO2, "locVid1c" );
}

TEST_F(HandTrackerLKGREYwMSwBPwBGSUBwFOxTest, FO3wlocVid1c ) {
	testTracker( FO3, "locVid1c" );
}

TEST_F(HandTrackerLKGREYwMSwBPwBGSUBwFOxTest, FO4wlocVid1c ) {
	testTracker( FO4, "locVid1c" );
}



TEST_F(HandTrackerLKGREYwMSwBPwBGSUBwFOxTest, FO0wTrackerTest1 ) {
	testTracker( FO0, "TrackerTest1" );
}

TEST_F(HandTrackerLKGREYwMSwBPwBGSUBwFOxTest, FO1wTrackerTest1 ) {
	testTracker( FO1, "TrackerTest1" );
}

TEST_F(HandTrackerLKGREYwMSwBPwBGSUBwFOxTest, FO2wTrackerTest1 ) {
	testTracker( FO2, "TrackerTest1" );
}

TEST_F(HandTrackerLKGREYwMSwBPwBGSUBwFOxTest, FO3wTrackerTest1 ) {
	testTracker( FO3, "TrackerTest1" );
}

TEST_F(HandTrackerLKGREYwMSwBPwBGSUBwFOxTest, FO4wTrackerTest1 ) {
	testTracker( FO4, "TrackerTest1" );
}







			
			
		
		
		
